<script src="../utils/printLinkNode.js"></script>
<script type="text/javascript">
	
function ListNode(x){
    this.val = x;
    this.next = null;
}
let a = new ListNode(1)
let b = new ListNode(2)
let c = new ListNode(3)
a.next = b;
b.next = c;


function ReverseList(pHead)
{
    let p = null, q= null;
    while(pHead!=null){
        q = pHead;
        pHead = pHead.next;
        q.next = p;
        p = q;
    }
    return p;
}
let phead = ReverseList(a)
printLinkNode(phead)


</script>